layui.define(['layer', 'jquery'], function(exports) {
	var $ = layui.jquery
		, layer = layui.layer;
	
	var obj = {
		//个人信息
		myInfo: function (){
			var user = getCurrentUser();
			var content = '<ul class="site-dir" style="padding:25px 35px 8px 35px;"><li>账号：'+user.userAccount+'</li><li>用户名：'+user.userNickname+'</li>';
			content += '<li>手机号：'+user.mobilePhone+'</li><li>性别：'+user.sex+'</li><li>角色：'+user.roleName+'</li></ul>';
			layer.open({
				type: 1,
				title: '个人信息',
				area: '350px',
				offset: '120px',
				content: content,
				btn: ['关闭'],
				btnAlign: 'c'
			});
		},
	
		//显示表单弹窗
		updatePsw: function (){	
			layer.open({
				type: 1,
				title: "修改密码",
				area: '400px',
				offset: '120px',
				content: $("#pswModel").html()
			});
			$("#pswForm")[0].reset();
			$("#pswCancel").click(function(){
				layer.closeAll('page');
			});
		},
		
		//退出登录
		loginOut: function (){
			localStorage.removeItem("token");
			localStorage.removeItem("user");
			sessionStorage.removeItem("index-nav");
			layer.load(1);
			$.ajax({
				url: "api/login.json?token="+getToken(), 
				type: "DELETE", 
				dataType: "JSON", 
				success: function(data){
					location.replace("login.html");
				}
			});
		}
	};
	
	exports('info', obj);
});
